const { Sequelize } = require('sequelize');

// 在内部创建了一个连接池，我们不需要去管理连接
const sequelize = new Sequelize('schooldb', 'root', '123456', {
    host: 'localhost',
    dialect: 'mysql', /* 选择 'mysql' | 'mariadb' | 'postgres' | 'mssql' 其一 */
    logging: null, // 日志管理
});

async function ff() {
    try {
        await sequelize.authenticate();
        console.log('Connection has been established successfully.');
    } catch (error) {
        console.error('Unable to connect to the database:', error);
    }
}
// 测试连接成功
// ff()

// 定义模型(数据表)


module.exports = sequelize